package com.dqyt.lhq.controller;

import com.dqyt.khjc.bean.ResultMsg;
import com.dqyt.lhq.service.LhqSamplePcService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * 硫化氢Controller
 */
@RestController
public class LhqSamplePcController {

    @Autowired
    private LhqSamplePcService lhqSamplePcService;

    /**
     * 更具设备编号查询样品信息
     * @param request
     * @param ccbh  出厂编号
     * @return
     */
    @RequestMapping(value = "/api/getPcSample4", method = {RequestMethod.GET,RequestMethod.POST})
    public ResultMsg getPcSample2(HttpServletRequest request, String ccbh, String jlbh, String erweima) {
        ResultMsg resultMsg =lhqSamplePcService.getPcSample2(request,ccbh,jlbh,erweima);
        return resultMsg;
    }


    /**
     * 查询样品信息
     * @param request
     * @param ccbh  出厂编号
     * @param jlbh 记录编号
     * @param erweima 二维码
     * @return
     */
    @RequestMapping(value = "/api/getPcSample5", method = {RequestMethod.GET,RequestMethod.POST})
    public ResultMsg getPcSample(HttpServletRequest request,String ccbh, String jlbh, String erweima) {
        ResultMsg resultMsg =lhqSamplePcService.getPcSample5(request,ccbh,jlbh,erweima);
        return resultMsg;
    }



    /**
     * 新增样品信息
     * @param request
     * @param sample
     * @return
     */
    @RequestMapping(value = "/api/savePcLyqSample", method = {RequestMethod.GET,RequestMethod.POST})
    public ResultMsg savePcLyqSample(HttpServletRequest request,String sample){
        ResultMsg resultMsg =lhqSamplePcService.savePcLyqSample(request,sample);
        return resultMsg;
    }


    /**
     * 分页查询样品
     * @param request 请求
     * @param pageNum  页数
     * @param pageSize  每页条数
     * @param erweima  二维码
     * @return
     */
    @RequestMapping(value = "/api/getLhqSampleListPage", method = {RequestMethod.POST})
    public ResultMsg getLhqSampleListPage(HttpServletRequest request,
                                       @RequestParam(defaultValue = "1") Integer pageNum,
                                       @RequestParam(defaultValue = "10") Integer pageSize,
                                       @RequestParam(name = "jlbh", required = false, defaultValue = "")  String jlbh,
                                       @RequestParam(name = "ccbh", required = false, defaultValue = "")  String ccbh,
                                       @RequestParam(name = "jlrId", required = false, defaultValue = "")  String jlrId,
                                       @RequestParam(name = "erweima", required = false, defaultValue = "")  String erweima){

        ResultMsg resultMsg = lhqSamplePcService.getLhqSampleListPage(request,pageNum, pageSize, jlbh,ccbh,jlrId, erweima);
        return resultMsg;
    }


    /**
     *
     * @param request
     * @return
     */
    @RequestMapping(value = "/api/getPcSpBybsbh", method = {RequestMethod.POST})
    public ResultMsg  getPcSpBybsbh(HttpServletRequest request,String jlbh){
        ResultMsg resultMsg = lhqSamplePcService.getPcSpBybsbh(request,jlbh);
        return resultMsg;
    }



    /**
     * 新增 H2s对象样品信息
     * @param request
     * @return
     */
    @RequestMapping(value = "/api/savePcLyqH2sObj", method = {RequestMethod.GET,RequestMethod.POST})
    public ResultMsg savePcLyqH2sObj(HttpServletRequest request,String jlbh,String h2sObj){
        ResultMsg resultMsg =lhqSamplePcService.savePcLyqH2sObj(request,jlbh,h2sObj);
        return resultMsg;
    }
    /**
     * 新增 O2对象样品信息
     * @param request
     * @return
     */
    @RequestMapping(value = "/api/savePcLyqO2Obj", method = {RequestMethod.GET,RequestMethod.POST})
    public ResultMsg savePcLyqO2Obj(HttpServletRequest request,String jlbh,String O2Obj){
        ResultMsg resultMsg =lhqSamplePcService.savePcLyqO2Obj(request,jlbh,O2Obj);
        return resultMsg;
    }

    /**
     * 新增 ch4对象样品信息
     * @param request
     * @return
     */
    @RequestMapping(value = "/api/savePcLyqCh4Obj", method = {RequestMethod.GET,RequestMethod.POST})
    public ResultMsg savePcLyqCh4Obj(HttpServletRequest request,String jlbh,String ch4Obj){
        ResultMsg resultMsg =lhqSamplePcService.savePcLyqCh4Obj(request,jlbh,ch4Obj);
        return resultMsg;
    }
    /**
     * 新增 CO对象样品信息
     * @param request
     * @return
     */
    @RequestMapping(value = "/api/savePcLyqCoObj", method = {RequestMethod.GET,RequestMethod.POST})
    public ResultMsg savePcLyqCoObj(HttpServletRequest request,String jlbh,String coObj){
        ResultMsg resultMsg =lhqSamplePcService.savePcLyqCoObj(request,jlbh,coObj);
        return resultMsg;
    }



    /**
     *
     * @return
     */
    @RequestMapping(value = "/api/deleteLhqSamp")
    public ResultMsg deleteLhqSamp(HttpServletRequest request,String bh){
        ResultMsg resultMsg = lhqSamplePcService.deleteLhqSamp(request, bh);
        return resultMsg;
    }


}
